// 公共的接口， 获取性别等代码接口
import qs from 'qs'
import request from '@/utils/request'
// 配置公共的header
const headers = {
  'Content-Type': 'application/json;charset=utf-8'
}
/**
 * @name getDictByBzdm
 * @description 根据代码获取信息
 * @param { bzdm } 代码名称
 * @bzdms  DM-RDXB  性别代码
 * @bzdms  DORMDM-ZSBZ  床位费代码
 * @bzdms  XXDM-RXNJ  学年
 * @author cjs1992
 * @date 2019-09-05 09:51:15
 */
export function getDictByBzdm(data) {
  return request({
    url: '/web/sysDict/getDictByBzdm',
    method: 'get',
    params: data
  })
}
/**
 * @name buildJxjgTree
 * @description 获取机构树
 * @author cjs1992
 * @date 2019-09-12 15:00:10
 */
export function buildJxjgTree(data = {}) {
  return request({
    url: '/web/common/buildJxjgTree',
    method: 'get',
    params: data
  })
}
/**
 * @name buildLyjgTree
 * @description 获取楼宇tree
 * @author cjs1992
 * @date 2019-09-16 15:21:13
 */
export function buildLyjgTree(data = {}) {
  return request({
    url: '/web/common/buildLyjgTree',
    method: 'get',
    params: data
  })
}
/**
 * @name buildLyjgTree2
 * @description 获取楼宇tree-到床位
 * @author cjs1992
 * @date 2019-09-20 15:37:32
 */
export function buildLyjgTree2(data = {}) {
  return request({
    url: '/web/common/buildLyjgTree2',
    method: 'get',
    params: data
  })
}
const url_lazy = '/web/common/'
/**
 * @name getAllLyfl
 * @description 获取所有的楼宇分类
 * @author cjs1992
 * @date 2019-09-26 18:14:26
 */
export function getAllLyfl(data = {}) {
  return request({
    url: `${url_lazy}getAllLyfl`,
    method: 'get',
    params: data
  })
}
/**
 * @name getAllLy
 * @description 获取楼宇
 * @param {id}
 * @author cjs1992
 * @date 2019-09-27 08:36:53
 */
export function getAllLy(data = {}) {
  return request({
    url: `${url_lazy}getAllLy`,
    method: 'get',
    params: data
  })
}
/**
 * @name getAllLc
 * @description 获取楼层
 * @param { id }
 * @author cjs1992
 * @date 2019-09-27 08:36:53
 */
export function getAllLc(data = {}) {
  return request({
    url: `${url_lazy}getAllLc`,
    method: 'get',
    params: data
  })
}
/**
 * @name getAllFj
 * @description 获取房间
 * @param { id }
 * @author cjs1992
 * @date 2019-09-27 08:36:53
 */
export function getAllFj(data = {}) {
  return request({
    url: `${url_lazy}getAllFj`,
    method: 'get',
    params: data
  })
}
/**
 * @name getAllCw
 * @description 获取床位
 * @param { id }
 * @author cjs1992
 * @date 2019-09-27 08:36:53
 */
export function getAllCw(data = {}) {
  return request({
    url: `${url_lazy}getAllCw`,
    method: 'get',
    params: data
  })
}
/**
 * @name getZzjgYxAll
 * @description 获取所有的院系
 * @author cjs1992
 * @date 2019-11-14 16:31:31
 */
export function getZzjgYxAll(data = {}) {
  return request({
    url: `/web/common/getZzjgYxAll`,
    method: 'get',
    params: data
  })
}
/**
 * @name getZzjgZyAll
 * @description 根据院系查询专业，院系可为空
 * @param id
 * @author cjs1992
 * @date 2019-11-14 16:32:44
 */
export function getZzjgZyAll(data = {}) {
  const { id } = data
  return request({
    method: 'get',
    url: `/web/common/getZzjgZyAll`,
    params: {
      id
    }
  })
}
/**
 * @name buildLyflAndLyTree
 * @description 获取楼宇分类和楼宇
 * @author cjs1992
 * @date 2019-12-09 11:11:46
 */
export function buildLyflAndLyTree(data = {}) {
  return request({
    method: 'get',
    url: `/web/common/buildLyflAndLyTree`,
    params: data
  })
}
/**
 * @name buildLcAndFjTree
 * @description 获取楼层和房间
 * @param {
 *  lyId
 * }
 * @author cjs1992
 * @date 2019-12-09 11:13:08
 */
export function buildLcAndFjTree(data = {}) {
  return request({
    method: 'get',
    url: `/web/common/buildLcAndFjTree`,
    params: data
  })
}
/**
 * @name findJzgxxList
 * @description 添加管理员获取教职工数据
 * @param { search }
 * @author cjs1992
 * @date 2019-09-10 13:40:34
 */
export function findJzgxxList(data = {}) {
  return request({
    url: `/web/common/findJzgxxList`,
    method: 'post',
    data: data,
    ...headers
  })
}
/**
 * @name printInterFace
 * @description 打印
 * @param {
 *  id,
 *  dm 打印类型代码
 * }
 * @author cjs1992
 * @date 2020-03-25 10:26:13
 */
export function printInterFace(data = {}) {
  return request({
    url: '/web/common/printInterFace',
    data: data,
    method: 'post'
  })
}
